#include "selectionTest.h"


selectionTest::selectionTest()
{
}


selectionTest::~selectionTest()
{
}

void* selectionTest::creator()
{
	return new selectionTest();
}

MStatus selectionTest::doIt(const MArgList& args)
{
	MStatus status;

	MSelectionList selectedObjs;

	MGlobal::getActiveSelectionList(selectedObjs);

	if (selectedObjs.isEmpty())
	{
		MGlobal::displayInfo("selection list is empty");
		return MS::kSuccess;
	}

	for (unsigned i=0; i<selectedObjs.length(); ++i)
	{
		MDagPath dag_path;
		MObject m_components;

		selectedObjs.getDagPath(i, dag_path, m_components);

		MString dag_name = dag_path.partialPathName();

		MGlobal::displayInfo("selected dag is:"+dag_name);

		if (!(m_components==MObject::kNullObj))
		{
			MStringArray selected_components;
			selectedObjs.getSelectionStrings(selected_components);

			for (unsigned i = 0; i < selected_components.length(); i++)
			{
				MGlobal::displayInfo(MString("\n") + selected_components[i]);
			}
		}

	}

	return status;
}
